﻿using System;
using System.Windows.Forms;
using System.Text;
using System.Drawing;

namespace commonV2.controls
{
    public class baseMenuStrip : MenuStrip
    {
        public baseMenuStrip()
        {
            this.Renderer = new vsMenu.vsToolStripRenderer();
        }
        protected virtual void ApplyTheme()
        {
            if (Settings.sysIsDesignMode) return;
            ColorSet cs = ThemeLibs.GetColorSet(ColorTypes.StripMenu, ColorSubTypes.MainMenu);
            if (cs != null) vsMenu.clsColor.SetColorMenu(cs.BackColor, cs.ForeColor);

            cs = ThemeLibs.GetColorSet(ColorTypes.StripMenu,ColorSubTypes.SubMenu);
            if (cs != null) vsMenu.clsColor.SetColorMenuItem(cs.BackColor, cs.ForeColor);

            cs = ThemeLibs.GetColorSet(ColorTypes.StripMenu, ColorSubTypes.MenuIcon);
            if (cs != null) vsMenu.clsColor.SetColorMenuIcon(cs.BackColor, cs.ForeColor);

            cs = ThemeLibs.GetColorSet(ColorTypes.StripMenu, ColorSubTypes.MenuSelection);
            if (cs != null) vsMenu.clsColor.SetColorMenuSelected(cs.BackColor, cs.ForeColor);

            this.Renderer = new vsMenu.vsToolStripRenderer();
        }
        protected override void OnLayout(LayoutEventArgs e)
        {
            ApplyTheme();
            base.OnLayout(e);
        }
    }
}